package com.tshopping.controller;

import com.tshopping.service.SearchService;
import com.tshopping.util.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @name: SearchController
 * @description: 搜索页面控制器
 * @author: Jackeys
 * @date: 2021-02-01 10:41
 */
@RestController
@RequestMapping("/SearchController")
@CrossOrigin
public class SearchController {
    @Autowired
    private SearchService searchService;

    @PostMapping("/searchStore")
    /**
     * @description 搜索店铺
     * @Param: keyWord
     * @Param: currentPage
     * @return ResponseData
     * @author Jackeys
     * @date 2021-02-01 10:43
     */
    public ResponseData searchStore(String keyWord,int currentPage){
        return searchService.searchStore(keyWord,currentPage);
    }

    @PostMapping(value = "/searchGoods")
    /**
     * @description 搜索商品
     * @Param: keyWord
     * @Param: currentPage
     * @return ResponseData
     * @author Jackeys
     * @date 2021-02-01 10:45
     */
    public ResponseData searchGoods(String keyWord,int currentPage){
        return searchService.searchGoods(keyWord,currentPage);
    }
}
